<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Proxy</title>
</head>

<body>
    <script>
        let obj = {
            name: 'zyt'
        }

        let handler = {
            get: function (target, key) {
                console.log('read');

                return target[key]
            },
            set: function (target, key, value) {
                console.log('set');

                target[key] = value
            },
            has: function (target, key) {
                console.log('has');

                if (target[key]) {
                    return true
                } else {
                    return false
                }
            }
        }

        let newObj = new Proxy(obj, handler)
        newObj.name = '112'
        newObj.name
    </script>
</body>

</html>